<?php


use Plugins\Demo\Http\Admin\Controller\IndexController;
use Sc\Util\HtmlStructure\Form;
use Sc\Util\HtmlStructure\Form\FormItem;
use Sc\Util\HtmlStructure\Html\Html;
use Sc\Util\HtmlStructure\Html\Js;
use Sc\Util\HtmlStructure\Html\Js\VueComponents\Temporary;
use Sc\Util\HtmlStructure\Table;

Html::create('直接给定表格数据');

$tableData = [
    ['id' => 1, 'name' => 'demo1', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 2, 'name' => 'demo2', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 3, 'name' => 'demo3', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 4, 'name' => 'demo4', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 5, 'name' => 'demo5', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 6, 'name' => 'demo6', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 7, 'name' => 'demo7', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 8, 'name' => 'demo8', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 9, 'name' => 'demo9', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
    ['id' => 10, 'name' => 'demo10', 'status' => 1, 'created_at' => '2022-01-01 00:00:00', 'age' => 18, 'sex' => 1, 'sex_text' => '男', 'intro' => '男人至死是少年，女人至死是少女'],
];

$table = Table::create(
    $tableData,
    // 第二个参数为表格ID，用于区分多个表格
    'demo4'
)->addColumns(
    Table\Column::selection(),
    Table\Column::normal('ID', 'id'),
    Table\Column::normal('姓名', 'name'),
    Table\Column::normal('年龄', 'age'),
    Table\Column::normal('状态', 'status'),
    Table\Column::normal('简介', 'intro'),
    Table\Column::normal('创建时间', 'created_at'),
);

// 关闭列设置
$table->setOpenSetting(false);

return $table->render();